package main.test.sparklingGraphAPI
import main.test.sparklingGraphAPI.LoadingGraph.ctx
import ml.sparkling.graph.generators.ring.{RingGenerator, RingGeneratorConfiguration}
import ml.sparkling.graph.generators.wattsandstrogatz.{WattsAndStrogatzGenerator, WattsAndStrogatzGeneratorConfiguration}
object GraphGenerator {
  def main(args: Array[String]): Unit = {

    //Using library you can easily generate networks using commonly used module.
    //Ring
    /**
     * Generator creates simple ring network with given number of node.
     */
    val graph =RingGenerator.generate(RingGeneratorConfiguration(numberOfNodes=5))

    // network can be also created in undirected version
    val graph2 = RingGenerator.generate(RingGeneratorConfiguration(numberOfNodes = 5, undirected = true))


    // Watts and strogatz
    /**
     * Model accepts 3 parameters.
     *  1 n -- number of nodes
     *  2 k -- mean degree
     *  3 beta -- probability of rewiring
     *
     *  Generation is done in 2 steps:
     *    1 Ring network with n nodes is created, each of nodes is connected to
     *    k/2 nodes on left and right.
     *    每个节点都连接到k/2个节点 on left and right.
     *    2 each edge is rewired with probability beta, where destination node
     *    is selected randomly from all possible not existing connections.
     *    每个边都使用概率beta重新连线，其中新的目的节点从所有不存在的连接中随机挑选。
     *
     *  more information : https://sparkling-graph.readthedocs.io/en/latest/localClustering.html#watts
     *
     * References: Collective dynamics of ‘small-world’ networks
     * Location:  References/Collective dynamics of ‘small-world’ networks.pdf
     */
     val graph3 = WattsAndStrogatzGenerator.generate(WattsAndStrogatzGeneratorConfiguration(numberOfNodes = 10,
       meanDegree = 2, rewiringProbability = 0.5))




  }

}
